<?php if (!defined('THINK_PATH')) exit();?><div class="bjui-pageHeader">
    <div class="pull-right">
        <!-- <button type="button" class="btn-default send_email" data-icon="envelope" title="发邮件" data-toggle="tooltip" data-placement="bottom"></button> -->
        <button type="button" class="btn-default send_msg" data-icon="envelope-o" title="发站内信" data-toggle="tooltip" data-placement="bottom"></button>
        <button class="btn-default" data-icon="plus" title="添加商家" data-toggle="tooltip" data-placement="bottom" onclick="createNavtab('<?php echo U("Forms/addshop");?>', '新增商家', 'addshop')" ></button>
        <!-- <a href="<?php echo U('index/save');?>" class="btn btn-default" data-toggle="doajaxchecked" data-icon="remove" data-callback="callbackRefres" data-confirm-msg="要删除全部选中的吗??" data-idname="id" data-group="ids"></a> -->
        <button class="btn-default" data-icon="refresh" onclick="$.CurrentNavtab.navtab('refresh')"></button>
    </div>
    <form id="pagerForm" data-toggle="ajaxsearch" data-loadingmask="true" action="<?php echo U('index');?>" method="post">
        <input type="hidden" name="pageSize" value="<?php echo I('param.pageSize');?>" />
        <input type="hidden" name="pageCurrent" value="<?php echo I('param.pageCurrent');?>" />
        <input type="hidden" name="orderField" value="<?php echo I('param.orderField');?>" />
        <input type="hidden" name="orderDirection" value="<?php echo I('param.orderDirection');?>" />
        <div class="bjui-searchBar">
            <label>显示状态:</label>
            <select name="status" data-toggle="selectpicker">
                <option value="">全部</option>
                <option value="0" <?php if(I('status') == '0'): ?>selected<?php endif; ?>>正常</option>
                <option value="1" <?php if(I('status') == '1'): ?>selected<?php endif; ?>>已关闭</option>
            </select>
           <label>审核状态:</label>
            <select name="is_check" data-toggle="selectpicker">
                <option value="">--请选择--</option>
                <option value="0" <?php if(I('is_check') == '0'): ?>selected<?php endif; ?>>未审核</option>
                <option value="1" <?php if(I('is_check') == '1'): ?>selected<?php endif; ?>>已审核</option>
                <option value="2" <?php if(I('is_check') == '2'): ?>selected<?php endif; ?>>审核未通过</option>
            </select>
            <label>关键字:</label>
            <input type="text" name="name" value="<?php echo I('name');?>"placeholder="商家名称、账号、地址" />
            <button type="submit" class="btn-default" data-icon="search">查询</button>
            <a class="btn btn-orange" href="javascript:;" data-toggle="reloadsearch" data-clear-query="true" data-icon="undo">清空查询 </a>
        </div>
    </form>
</div>
<div class="bjui-pageContent tableContent">
    <table class="table table-bordered table-hover table-striped table-top" data-selected-multi="false">
        <thead>
        <tr>
            <th width="26"><input type="checkbox" class="checkboxCtrl" data-group="ids" data-toggle="icheck"></th>
            <th>登陆账号</th>
            <th>公司名称</th>
            <th>添加时间</th>
            <th>审核状态</th>
            <th>状态</th>
            <!--<th>手机号码</th>
            <th>余额</th>
            <th>积分</th>
            <th>注册日期</th> -->
            <th width="140">操作</th>
        </tr>
        </thead>
        <tbody>
        <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
            <td width="26"><input type="checkbox" value="<?php echo ($vo["id"]); ?>" class="checkboxCtrl" name="ids" data-toggle="icheck"></td>
            <td><?php echo ($vo["username"]); ?></td>
            <td><?php echo ($vo["shop_name"]); ?></td>
            <td><?php echo ($vo["add_time"]); ?></td>
            <td><?php if($vo["is_check"] == '0'): ?>未审核<?php else: ?>已审核 审核人：<?php echo ($vo["adminname"]); endif; ?></td>
            <td>
            <?php if($vo["close"] == '0'): ?><a href="<?php echo U('Forms/update_shop',array('id'=>$vo['id']));?>" data-type="get" data-toggle="doajax" data-confirm-msg="确定要关闭这个商家吗??">正常</a>
            <?php else: ?>
               <a href="<?php echo U('Forms/update_shop',array('id'=>$vo['id']));?>" data-type="get" data-toggle="doajax" data-confirm-msg="确定要开启这个商家吗??">已关闭</a><?php endif; ?>
            </td>
            <!-- <td>0</td>
            <td><?php echo ($vo["mobile"]); ?></td>
            <td><?php echo ($vo["balance"]); ?></td>
            <td><?php echo ($vo["point"]); ?></td>
            <td><?php echo ($vo["add_time"]); ?></td> -->
            <td>
                <button type="button" class="btn-green" onclick="createNavtab('<?php echo U("Forms/addshop",array('id'=>$vo["id"]));?>', '编辑商家资料', 'member_msg')">改</button>
                <?php if($vo["is_check"] == '0'): ?><button type="button" class="btn-green" onclick="createDialog('<?php echo U("Forms/checkshop",array("id"=>$vo["id"]));?>', '审核商家', 'member_msg', {width:800, height:500})">审</button><?php endif; ?>
                <a href="<?php echo U('Forms/del_shop',array('id'=>$vo['id']));?>" data-type="get" class="btn btn-red" data-toggle="doajax" data-confirm-msg="你确定要删除吗？删除之后就不能恢复啦" >删</a>
            </td>
        </tr><?php endforeach; endif; else: echo "" ;endif; ?>
        </tbody>
    </table>
</div>
<script>
    $(function () {
        function checkout() {
            var ids = [];
            $.CurrentNavtab.find('input[name=ids]').each(function (index, item) {
                if(item.checked){
                    ids.push(item.value);
                }
            });
            return ids;
        }
       $('.send_email').click(function () {
            var ids = checkout();
           if( ids.length < 1 ){
               $(this).alertmsg('error', '请至少选择一位会员');
               return ;
           }
           createDialog('<?php echo U("Forms/email");?>?uid='+ids.join(','), '发邮件', 'send_email', {width:800, height:500} ) ;
       });
        $('.send_msg').click(function () {
            var ids = checkout();
            if( ids.length < 1 ){
                $(this).alertmsg('error', '请至少选择一位会员');
                return ;
            }
            createDialog("<?php echo U('Forms/msg');?>?uid=" + ids.join(','), '发站内信', 'send_msg', {width:800, height:500});
        });
    });
</script>

<div class="bjui-pageFooter">
		
	<?php if(page == save): ?><ul>
			<li><button type="submit" class="btn-default" data-icon="save">保存</button></li>
	        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
	    </ul>
	<?php elseif(page == close): ?>
	    <ul>
	        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
	    </ul>
	<?php elseif(page == page and $show != null): ?>
		<ul>
	        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
	    </ul>
		    <div class="pages">
		        <span>每页&nbsp;</span>
		        <div class="selectPagesize">
		            <select data-toggle="selectpicker" data-toggle-change="changepagesize">
		                <option value="<?php echo ($show['listrow']); ?>"><?php echo ($show['listrow']); ?></option>
		                <option value="60">60</option>
		                <option value="120">120</option>
		                <option value="150">150</option>
		            </select>
		        </div>
		        <span>&nbsp;条，共 <?php echo ($show['total']); ?> 条</span>
		    </div>
		    <div class="pagination-box" data-toggle="pagination" data-total="<?php echo ($show['total']); ?>" data-page-size="<?php echo ($show['listrow']); ?>" data-page-current="1">
		    </div>
	<?php elseif(page == page and $show == null): ?>
		<ul>
			<li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
		</ul>
	<?php else: ?>
		<ul>
			<li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
		</ul><?php endif; ?>

</div>